# coding:utf-8
from collections import defaultdict

import jieba

# 情感词典分析的是整个文章的情感倾向。
# s1: 数据清洗，删除停用词（将停用词加载到内存，dict/stopwords），包括标点符号
# s2: 分词（jieba分词）
# s3: 查表统计
from sentiment import stopwords
from sentiment.senti_dict.Any import DictAnalysis


class DictSentiment(object):
    @classmethod
    def init(cls):
        cls.ant = DictAnalysis()
    @classmethod
    def sentiment(cls, text:str):
        '''

        :param text:
        :return: (pos,neg)
        '''
        return cls.ant.article_sentiment(text)
DictSentiment.init()

if __name__ == '__main__':
    # res = SentimentDict.sentiment(open('data/article.txt',encoding='utf-8').read())
    # print(res)
    DictSentiment.sentiment("证明 一张")
